Optimal. Leaf size=256 \[ \frac {\left (6 A b^2+a^2 (A+2 C)\right ) x}{2 a^4}-\frac {2 b \left (4 a^2 A b^2-3 A b^4+2 a^4 C-a^2 b^2 C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^4 (a-b)^{3/2} (a+b)^{3/2} d}+\frac {b \left (3 A b^2-a^2 (2 A-C)\right ) \sin (c+d x)}{a^3 \left (a^2-b^2\right ) d}-\frac {\left (3 A b^2-a^2 (A-2 C)\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right ) d}+\frac {\left (A b^2+a^2 C\right ) \cos (c+d x) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.63, antiderivative size = 256, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 33, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {4186, 4189,
4004, 3916, 2738, 214} \begin {gather*} -\frac {\left (3 A b^2-a^2 (A-2 C)\right ) \sin (c+d x) \cos (c+d x)}{2 a^2 d \left (a^2-b^2\right )}+\frac {\left (a^2 C+A b^2\right ) \sin (c+d x) \cos (c+d x)}{a d \left (a^2-b^2\right ) (a+b \sec (c+d x))}+\frac {x \left (a^2 (A+2 C)+6 A b^2\right )}{2 a^4}-\frac {2 b \left (2 a^4 C+4 a^2 A b^2-a^2 b^2 C-3 A b^4\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^4 d (a-b)^{3/2} (a+b)^{3/2}}+\frac {b \left (3 A b^2-a^2 (2 A-C)\right ) \sin (c+d x)}{a^3 d \left (a^2-b^2\right )} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 214
Rule 2738
Rule 3916
Rule 4004
Rule 4186
Rule 4189
Rubi steps
\begin {align*} \int \frac {\cos ^2(c+d x) \left (A+C \sec ^2(c+d x)\right )}{(a+b \sec (c+d x))^2} \, dx &=\frac {\left (A b^2+a^2 C\right ) \cos (c+d x) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac {\int \frac {\cos ^2(c+d x) \left (3 A b^2-a^2 (A-2 C)+a b (A+C) \sec (c+d x)-2 \left (A b^2+a^2 C\right ) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{a \left (a^2-b^2\right )}\\ &=-\frac {\left (3 A b^2-a^2 (A-2 C)\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right ) d}+\frac {\left (A b^2+a^2 C\right ) \cos (c+d x) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}+\frac {\int \frac {\cos (c+d x) \left (2 b \left (3 A b^2-a^2 (2 A-C)\right )+a \left (A b^2+a^2 (A+2 C)\right ) \sec (c+d x)-b \left (3 A b^2-a^2 (A-2 C)\right ) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{2 a^2 \left (a^2-b^2\right )}\\ &=\frac {b \left (3 A b^2-a^2 (2 A-C)\right ) \sin (c+d x)}{a^3 \left (a^2-b^2\right ) d}-\frac {\left (3 A b^2-a^2 (A-2 C)\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right ) d}+\frac {\left (A b^2+a^2 C\right ) \cos (c+d x) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}-\frac {\int \frac {-\left (a^2-b^2\right ) \left (6 A b^2+a^2 (A+2 C)\right )+a b \left (3 A b^2-a^2 (A-2 C)\right ) \sec (c+d x)}{a+b \sec (c+d x)} \, dx}{2 a^3 \left (a^2-b^2\right )}\\ &=\frac {\left (6 A b^2+a^2 (A+2 C)\right ) x}{2 a^4}+\frac {b \left (3 A b^2-a^2 (2 A-C)\right ) \sin (c+d x)}{a^3 \left (a^2-b^2\right ) d}-\frac {\left (3 A b^2-a^2 (A-2 C)\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right ) d}+\frac {\left (A b^2+a^2 C\right ) \cos (c+d x) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}+\frac {\left (b \left (3 A b^4-a^2 b^2 (4 A-C)-2 a^4 C\right )\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{a^4 \left (a^2-b^2\right )}\\ &=\frac {\left (6 A b^2+a^2 (A+2 C)\right ) x}{2 a^4}+\frac {b \left (3 A b^2-a^2 (2 A-C)\right ) \sin (c+d x)}{a^3 \left (a^2-b^2\right ) d}-\frac {\left (3 A b^2-a^2 (A-2 C)\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right ) d}+\frac {\left (A b^2+a^2 C\right ) \cos (c+d x) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}+\frac {\left (3 A b^4-a^2 b^2 (4 A-C)-2 a^4 C\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{a^4 \left (a^2-b^2\right )}\\ &=\frac {\left (6 A b^2+a^2 (A+2 C)\right ) x}{2 a^4}+\frac {b \left (3 A b^2-a^2 (2 A-C)\right ) \sin (c+d x)}{a^3 \left (a^2-b^2\right ) d}-\frac {\left (3 A b^2-a^2 (A-2 C)\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right ) d}+\frac {\left (A b^2+a^2 C\right ) \cos (c+d x) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}+\frac {\left (2 \left (3 A b^4-a^2 b^2 (4 A-C)-2 a^4 C\right )\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^4 \left (a^2-b^2\right ) d}\\ &=\frac {\left (6 A b^2+a^2 (A+2 C)\right ) x}{2 a^4}-\frac {2 b \left (4 a^2 A b^2-3 A b^4+2 a^4 C-a^2 b^2 C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^4 (a-b)^{3/2} (a+b)^{3/2} d}+\frac {b \left (3 A b^2-a^2 (2 A-C)\right ) \sin (c+d x)}{a^3 \left (a^2-b^2\right ) d}-\frac {\left (3 A b^2-a^2 (A-2 C)\right ) \cos (c+d x) \sin (c+d x)}{2 a^2 \left (a^2-b^2\right ) d}+\frac {\left (A b^2+a^2 C\right ) \cos (c+d x) \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \sec (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.02, size = 176, normalized size = 0.69 \begin {gather*} \frac {2 \left (6 A b^2+a^2 (A+2 C)\right ) (c+d x)-\frac {8 b \left (3 A b^4-2 a^4 C+a^2 b^2 (-4 A+C)\right ) \tanh ^{-1}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}-8 a A b \sin (c+d x)+\frac {4 a b^2 \left (A b^2+a^2 C\right ) \sin (c+d x)}{(a-b) (a+b) (b+a \cos (c+d x))}+a^2 A \sin (2 (c+d x))}{4 a^4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.26, size = 266, normalized size = 1.04
method | result | size |
derivativedivides | \(\frac {\frac {2 b \left (-\frac {a b \left (A \,b^{2}+a^{2} C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-a -b \right )}-\frac {\left (4 a^{2} A \,b^{2}-3 A \,b^{4}+2 a^{4} C -C \,a^{2} b^{2}\right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right ) \left (a -b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{a^{4}}+\frac {\frac {2 \left (\left (-\frac {1}{2} A \,a^{2}-2 a A b \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {1}{2} A \,a^{2}-2 a A b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\left (A \,a^{2}+6 A \,b^{2}+2 a^{2} C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{4}}}{d}\) | \(266\) |
default | \(\frac {\frac {2 b \left (-\frac {a b \left (A \,b^{2}+a^{2} C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-a -b \right )}-\frac {\left (4 a^{2} A \,b^{2}-3 A \,b^{4}+2 a^{4} C -C \,a^{2} b^{2}\right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right ) \left (a -b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{a^{4}}+\frac {\frac {2 \left (\left (-\frac {1}{2} A \,a^{2}-2 a A b \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {1}{2} A \,a^{2}-2 a A b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\left (A \,a^{2}+6 A \,b^{2}+2 a^{2} C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{4}}}{d}\) | \(266\) |
risch | \(\frac {A x}{2 a^{2}}+\frac {3 x A \,b^{2}}{a^{4}}+\frac {x C}{a^{2}}+\frac {2 i b^{2} \left (A \,b^{2}+a^{2} C \right ) \left (b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}{a^{4} \left (a^{2}-b^{2}\right ) d \left (a \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}-\frac {i A \,{\mathrm e}^{2 i \left (d x +c \right )}}{8 a^{2} d}-\frac {i A b \,{\mathrm e}^{-i \left (d x +c \right )}}{a^{3} d}+\frac {i A \,{\mathrm e}^{-2 i \left (d x +c \right )}}{8 a^{2} d}+\frac {i A b \,{\mathrm e}^{i \left (d x +c \right )}}{a^{3} d}+\frac {4 b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{2}}-\frac {3 b^{5} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{4}}+\frac {2 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}-\frac {b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{2}}-\frac {4 b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{2}}+\frac {3 b^{5} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) A}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{4}}-\frac {2 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}+\frac {b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{2}}\) | \(870\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.10, size = 838, normalized size = 3.27 \begin {gather*} \left [\frac {{\left ({\left (A + 2 \, C\right )} a^{7} + 4 \, {\left (A - C\right )} a^{5} b^{2} - {\left (11 \, A - 2 \, C\right )} a^{3} b^{4} + 6 \, A a b^{6}\right )} d x \cos \left (d x + c\right ) + {\left ({\left (A + 2 \, C\right )} a^{6} b + 4 \, {\left (A - C\right )} a^{4} b^{3} - {\left (11 \, A - 2 \, C\right )} a^{2} b^{5} + 6 \, A b^{7}\right )} d x + {\left (2 \, C a^{4} b^{2} + {\left (4 \, A - C\right )} a^{2} b^{4} - 3 \, A b^{6} + {\left (2 \, C a^{5} b + {\left (4 \, A - C\right )} a^{3} b^{3} - 3 \, A a b^{5}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) - {\left (2 \, {\left (2 \, A - C\right )} a^{5} b^{2} - 2 \, {\left (5 \, A - C\right )} a^{3} b^{4} + 6 \, A a b^{6} - {\left (A a^{7} - 2 \, A a^{5} b^{2} + A a^{3} b^{4}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (A a^{6} b - 2 \, A a^{4} b^{3} + A a^{2} b^{5}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{9} - 2 \, a^{7} b^{2} + a^{5} b^{4}\right )} d \cos \left (d x + c\right ) + {\left (a^{8} b - 2 \, a^{6} b^{3} + a^{4} b^{5}\right )} d\right )}}, \frac {{\left ({\left (A + 2 \, C\right )} a^{7} + 4 \, {\left (A - C\right )} a^{5} b^{2} - {\left (11 \, A - 2 \, C\right )} a^{3} b^{4} + 6 \, A a b^{6}\right )} d x \cos \left (d x + c\right ) + {\left ({\left (A + 2 \, C\right )} a^{6} b + 4 \, {\left (A - C\right )} a^{4} b^{3} - {\left (11 \, A - 2 \, C\right )} a^{2} b^{5} + 6 \, A b^{7}\right )} d x - 2 \, {\left (2 \, C a^{4} b^{2} + {\left (4 \, A - C\right )} a^{2} b^{4} - 3 \, A b^{6} + {\left (2 \, C a^{5} b + {\left (4 \, A - C\right )} a^{3} b^{3} - 3 \, A a b^{5}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) - {\left (2 \, {\left (2 \, A - C\right )} a^{5} b^{2} - 2 \, {\left (5 \, A - C\right )} a^{3} b^{4} + 6 \, A a b^{6} - {\left (A a^{7} - 2 \, A a^{5} b^{2} + A a^{3} b^{4}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (A a^{6} b - 2 \, A a^{4} b^{3} + A a^{2} b^{5}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{9} - 2 \, a^{7} b^{2} + a^{5} b^{4}\right )} d \cos \left (d x + c\right ) + {\left (a^{8} b - 2 \, a^{6} b^{3} + a^{4} b^{5}\right )} d\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (A + C \sec ^{2}{\left (c + d x \right )}\right ) \cos ^{2}{\left (c + d x \right )}}{\left (a + b \sec {\left (c + d x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.49, size = 315, normalized size = 1.23 \begin {gather*} -\frac {\frac {4 \, {\left (2 \, C a^{4} b + 4 \, A a^{2} b^{3} - C a^{2} b^{3} - 3 \, A b^{5}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{{\left (a^{6} - a^{4} b^{2}\right )} \sqrt {-a^{2} + b^{2}}} + \frac {4 \, {\left (C a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + A b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (a^{5} - a^{3} b^{2}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a - b\right )}} - \frac {{\left (A a^{2} + 2 \, C a^{2} + 6 \, A b^{2}\right )} {\left (d x + c\right )}}{a^{4}} + \frac {2 \, {\left (A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 4 \, A b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 4 \, A b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2} a^{3}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 13.27, size = 2500, normalized size = 9.77 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________